﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<WebMassage.Models.New>" %>

<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Tạo mới tin tức
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script src="<%= Url.Content("~/Scripts/jquery-1.4.1.js") %>" type="text/javascript"></script>
    <script type="text/javascript" src="<%= Url.Content("~/Scripts/jquery.validate.js") %>"> </script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#aspnetForm").validate({
                rules: {
                    Title: "required",
                    <%= Content.ClientID %>: "required"
                },
                messages: {
                    Title: " Chưa có dữ liệu",
                    <%= Content.ClientID %>: " Bạn chưa nhập nội dung cho tin tức mới"
                }
            });
        });
    </script>
    <div style="padding: 10px;">
        <h2>Tạo mới tin tức</h2>

        <br />
        <form id="aspnet" runat="server" >
        <% using (Html.BeginForm("Create", "New", FormMethod.Post, new { id = "FrmTintuc" }))
           {%>
        <fieldset style="padding: 10px;">
            <div class="editor-label">
              <font color="red">*</font>Tiêu đề:    <%= Html.TextBoxFor(model => model.Title, new { style = "width:70%" })%>
            </div>
            <div class="editor-label">
                <font color="red">*</font> Nội dung
            </div>
            <div class="editor-field">
                <CKEditor:CKEditorControl ID="Content" runat="server" ClientIDMode="Inherit">
                </CKEditor:CKEditorControl>
            </div>
            <div class="editor-label">
                Ngày tạo:    <%= string.Format("{0:dd/MM/yyyy}",DateTime.Now) %>
            </div>
            <div class="editor-label">
                Người tạo:   <% = Page.User.Identity.Name%>
            </div>
            <p>
                <input type="submit" value="Tạo mới" />
            </p>
        </fieldset>
        <% } %>
        </form>
     <div style="padding-top:20px">
               <%= Html.ActionLink("Trở về danh sách", "Manager") %>
        </div>
    </div>
</asp:Content>
